package com.fighthouse.telas
{
	import flash.events.MouseEvent;
	
	import mx.containers.VBox;
	import mx.controls.Button;
	import mx.events.FlexEvent;

	public class FormContato extends VBox
	{
		private var form:Form;
		private var btEnviar:Button;
		private var vBox1:VBox;
		private var vBox2:VBox;
		public function FormContato()
		{
			super();
			
			
			form = new Form();
			addChild(form);
			
			btEnviar = new Button();
			btEnviar.label = "Enviar";
			btEnviar.buttonMode = true;
			btEnviar.addEventListener(MouseEvent.CLICK, onEnviarClick);
			addChild(btEnviar)
			
			addEventListener(FlexEvent.CREATION_COMPLETE,creationComplete);
			addEventListener(FlexEvent.SHOW,onShow);
		}
		
		private function onShow(event:FlexEvent):void
		{
			form.zerar();
		}
		
		private function creationComplete(event:FlexEvent):void
		{
			
		}
		
		private function onEnviarClick(event:MouseEvent):void
		{
			form.enviar("augustuscosta@gmail.com");
		}
		
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
			if(form){
				form.width = this.width;
			}
			if(btEnviar){
				btEnviar.x = this.width - btEnviar.width - 30;
			}
		}
	}
}